# import packages
import psycopg2
import pandas as pd
from sqlalchemy import create_engine
from sqlalchemy.dialects.postgresql.base import PGDialect
PGDialect._get_server_version_info=lambda  *args: (9,2)
# establish connections
conn_string = "postgresql+psycopg2://root:hyb12345678!@1.94.255.17:8000/gaussdemo"
db = create_engine(conn_string)
conn = db.connect()
conn1 = psycopg2.connect(
database="gaussdemo",
user='root',
password='hyb12345678!',
host='1.94.255.17',
port= '8000'
)
conn1.autocommit = True
cursor = conn1.cursor()
query='''select * from parquet;'''
df=pd.read_sql(query,conn)
df.to_parquet('demo.parquet')
print('gauss数据成功写入parquet')

read_df = pd.read_parquet('demo.parquet')

print(read_df)
